import { getEnroll } from '../../../api/activity'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    enrollPropelData: [],
    activityId: '',
    curLoadPage: 1
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (e) {
    this.setData({
      activityId: e.activityId
    })

    this.init(this.data.activityId);
  },
  init(activityId){
    this.getEnroll(activityId)
  },
  async getEnroll(activityId){
    let _this = this
    let params = {
      condition: activityId,
      pager: {
        page: _this.data.curLoadPage,
        pageSize: 10
      }
    }
    let res = await getEnroll(params)
    _this.data.curLoadPage++;
    let enrollPropelData = _this.data.enrollPropelData.concat(res.records)
    _this.setData({
      enrollPropelData: enrollPropelData
    })
  },
  onClickPeople(event){
    let userId = event.currentTarget.dataset.userid
    wx.navigateTo({
      url:`/packageA/pages/joinUser/joinUser?userId=${userId}`
    })
  }
})
